import 'package:flutter/widgets.dart';
import 'package:video/common/entitys/entitys.dart';
import 'package:video/common/utils/utils.dart';

class VideoAPI {
  ///
  /// 平台操作
  /// @param channel 视频线路编码
  /// @param direct 操作方向编码 1-上,2-下,3-左,4-右
  ///
  static Future<R> ptzCtrl({
    @required BuildContext context,
    @required String channel,
    @required int direct,
  }) async {
    var params = {
      "channel": channel,
      "direct": direct,
    };
    var response = await HttpUtil().post(
      '/media/PtzCtrl',
      context: context,
      params: params,
    );
    return R.fromJson(response);
  }

  ///
  /// 平台操作
  /// @param channel 视频线路编码
  /// @param direct 操作方向编码 1-上,2-下,3-左,4-右
  ///
  static Future<R> getVideoUrl({
    @required BuildContext context,
    @required int id,
    @required String type,
  }) async {
    var params = {
      "id": id,
      "type": type,
    };
    var response = await HttpUtil().post(
      '/media/start',
      context: context,
      params: params,
    );
    return R.fromJson(response);
  }
}
